package com.qiandw.security

import java.util

import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.authority.SimpleGrantedAuthority
import org.springframework.security.core.userdetails.UserDetails

class MemberUserDetails(username: String) extends UserDetails {

  final val serialVersionUID = -440529056139726252L

  override def isAccountNonLocked: Boolean = {
    true
  }

  override def getAuthorities: util.Collection[_ <: GrantedAuthority] = {
    val authorities = new util.HashSet[GrantedAuthority]()
    authorities.add(new SimpleGrantedAuthority("ROLE_USER"))
    authorities
  }

  override def getUsername: String = {
    "user"
  }

  override def getPassword: String = {
    "111111"
  }

  override def isCredentialsNonExpired: Boolean = {
    true
  }

  override def isAccountNonExpired: Boolean = {
    true
  }

  override def isEnabled: Boolean = {
    true
  }
}
